<?php

/**
 * Author: Hancock
 * Email: 84622365@qq.com
 * Date: 3/28/2016
 * Des: 切换淘客账号类
 */
include_once ROOT_PATH . "inc/ali/tbk.class.php";
class collectUrl
{   
    private $tbk;
    private $siteName;
    public function __construct($app=ALI_APP_KEY)
    {    
       $this->siteName=$app;
       //$this->getAppSiteName();
       $this->tbk = new tbk($this->siteName); 
    }

    /**
     * 获取账号
     */
    public function getAppSiteName()
    {
        $mod = M("app.ali_app");
        $this->siteName=$mod->getAppSiteName();   
    }
    /**
     * 获取ip
     */
    public function getTbIpBySiteName()
    {
        $mod = M("app.ali_app");
        $tp_ip=$mod->getTbIpBySiteName($this->siteName); 
        return $tp_ip;  
    }
    /**
     * 获取广告位
     */
    public function distributionAdZoneId($member_id){
        $mod=M('app.ad_zone');
        $ad_zone_id=$mod->distributionAdZoneIdBySiteName($this->siteName,$member_id);
        return $ad_zone_id;
    }
    /**
     * 获取短链接
     */
    public function getSpreadClickUrlByUrl($url)
    {   
        return $this->tbk->getSpreadClickUrl($url);  
    }
    /**
     * 获取链接
     */
    public function getFavoritesClickUrl($ad_zone_id, $fav_id, $page, $page_size = 100)
    {
        return $this->tbk->getFavoritesClickUrl($ad_zone_id, $fav_id, $page, $page_size);   
    }
    /**
     * 获取选品库商品
     * @param  [type] $page [description]
     * @return [type]       [description]
     */
    public function getFavoritesInfo($page)
    {
        return $this->tbk->getFavoritesInfo($page);   
    }
    /**
     * 获取淘口令
     */
    public function getShareTpwd($logo,$title,$url)
    {
        return $this->tbk->getShareTpwd($logo,$title,$url);   
    }
    /**
     * 淘口令转化
     */
    public function getNumiidByTbkPass($tbk_pass)
    {
       return $this->tbk->getNumiidByTbkPass($tbk_pass);  
    }
}
